\hypertarget{battery_8c}{
\section{atmega1281/low/battery/battery.c File Reference}
\label{battery_8c}\index{atmega1281/low/battery/battery.c@{atmega1281/low/battery/battery.c}}
}
{\ttfamily \#include \char`\"{}battery.h\char`\"{}}\par
{\ttfamily \#include $<$avr/io.h$>$}\par
{\ttfamily \#include $<$avr/interrupt.h$>$}\par
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{battery_8c_aadcd026a2c91fe96c8134619c87bb72a}{BATT\_\-PORT}~PORTD
\item 
\#define \hyperlink{battery_8c_a0d891a2fc3af8c032eb7ea45d63bbc28}{BATT\_\-DDR}~DDRD
\item 
\#define \hyperlink{battery_8c_a92165ee224e6e3601f6973cca883fe51}{BATT\_\-PIN}~PD7
\begin{DoxyCompactList}\small\item\em Pin where the battery voltage will be readed. \item\end{DoxyCompactList}\item 
\#define \hyperlink{battery_8c_a5c2ae087586a37fc1fe933a90ecb6499}{ADC\_\-BATT\_\-100}~154
\item 
\#define \hyperlink{battery_8c_a96bc914b5b67f10ff68b39ded982bdeb}{ADC\_\-BATT\_\-0}~64
\item 
\#define \hyperlink{battery_8c_a7e6486f2431ccde4e61a91181f56d6ef}{ADC\_\-BATT\_\-LIMIT}~69
\item 
\#define \hyperlink{battery_8c_a4cf81b9098e2a01eacf1f7e46a492a55}{BATT\_\-VOLT\_\-MAX}~600
\item 
\#define \hyperlink{battery_8c_afad4dd6765302906f52c8df6f1dc69a5}{BATT\_\-VOLT\_\-MIN}~496
\item 
\#define \hyperlink{battery_8c_a369364b639980900487ad027ac62f7b3}{BATT\_\-LINEALIZE}~4
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{group__nxbot__batt_gabfbbfb986d008991dbbe32035cbdcde6}{battery\_\-init} ()
\begin{DoxyCompactList}\small\item\em Hardware initialization for the battery module. \item\end{DoxyCompactList}\item 
void \hyperlink{group__nxbot__batt_gabf908968d26d8f291a60846d6dd51251}{battery\_\-ledEnable} (unsigned char en)
\begin{DoxyCompactList}\small\item\em Function used to write the state of the battery-\/LED, located in the rear of NXBot. \item\end{DoxyCompactList}\item 
unsigned char \hyperlink{group__nxbot__batt_gaa4799455728e1873e05d8bbe460d03fc}{battery\_\-getState} ()
\begin{DoxyCompactList}\small\item\em Reads the state of the battery, in \mbox{[}\%\mbox{]} units. \item\end{DoxyCompactList}\item 
unsigned int \hyperlink{group__nxbot__batt_gada2d7b272290fee99245113b1c134a20}{battery\_\-getVoltage} ()
\begin{DoxyCompactList}\small\item\em Reads the state of the battery, in \mbox{[}V\mbox{]} units. \item\end{DoxyCompactList}\item 
unsigned int \hyperlink{group__nxbot__batt_gaec4ef3b620c24ee1c4ea58e26fe93cb3}{battery\_\-read} (unsigned char type)
\begin{DoxyCompactList}\small\item\em Read the state of the battery, wether voltage or percentage. \item\end{DoxyCompactList}\item 
\hyperlink{battery_8c_a05c2e5b588ced1cd7312f5b0edc5b295}{ISR} (ADC\_\-vect)
\end{DoxyCompactItemize}


\subsection{Define Documentation}
\hypertarget{battery_8c_a96bc914b5b67f10ff68b39ded982bdeb}{
\index{battery.c@{battery.c}!ADC\_\-BATT\_\-0@{ADC\_\-BATT\_\-0}}
\index{ADC\_\-BATT\_\-0@{ADC\_\-BATT\_\-0}!battery.c@{battery.c}}
\subsubsection[{ADC\_\-BATT\_\-0}]{\setlength{\rightskip}{0pt plus 5cm}\#define ADC\_\-BATT\_\-0~64}}
\label{battery_8c_a96bc914b5b67f10ff68b39ded982bdeb}
\hypertarget{battery_8c_a5c2ae087586a37fc1fe933a90ecb6499}{
\index{battery.c@{battery.c}!ADC\_\-BATT\_\-100@{ADC\_\-BATT\_\-100}}
\index{ADC\_\-BATT\_\-100@{ADC\_\-BATT\_\-100}!battery.c@{battery.c}}
\subsubsection[{ADC\_\-BATT\_\-100}]{\setlength{\rightskip}{0pt plus 5cm}\#define ADC\_\-BATT\_\-100~154}}
\label{battery_8c_a5c2ae087586a37fc1fe933a90ecb6499}
\hypertarget{battery_8c_a7e6486f2431ccde4e61a91181f56d6ef}{
\index{battery.c@{battery.c}!ADC\_\-BATT\_\-LIMIT@{ADC\_\-BATT\_\-LIMIT}}
\index{ADC\_\-BATT\_\-LIMIT@{ADC\_\-BATT\_\-LIMIT}!battery.c@{battery.c}}
\subsubsection[{ADC\_\-BATT\_\-LIMIT}]{\setlength{\rightskip}{0pt plus 5cm}\#define ADC\_\-BATT\_\-LIMIT~69}}
\label{battery_8c_a7e6486f2431ccde4e61a91181f56d6ef}
\hypertarget{battery_8c_a0d891a2fc3af8c032eb7ea45d63bbc28}{
\index{battery.c@{battery.c}!BATT\_\-DDR@{BATT\_\-DDR}}
\index{BATT\_\-DDR@{BATT\_\-DDR}!battery.c@{battery.c}}
\subsubsection[{BATT\_\-DDR}]{\setlength{\rightskip}{0pt plus 5cm}\#define BATT\_\-DDR~DDRD}}
\label{battery_8c_a0d891a2fc3af8c032eb7ea45d63bbc28}
\hypertarget{battery_8c_a369364b639980900487ad027ac62f7b3}{
\index{battery.c@{battery.c}!BATT\_\-LINEALIZE@{BATT\_\-LINEALIZE}}
\index{BATT\_\-LINEALIZE@{BATT\_\-LINEALIZE}!battery.c@{battery.c}}
\subsubsection[{BATT\_\-LINEALIZE}]{\setlength{\rightskip}{0pt plus 5cm}\#define BATT\_\-LINEALIZE~4}}
\label{battery_8c_a369364b639980900487ad027ac62f7b3}
\hypertarget{battery_8c_a92165ee224e6e3601f6973cca883fe51}{
\index{battery.c@{battery.c}!BATT\_\-PIN@{BATT\_\-PIN}}
\index{BATT\_\-PIN@{BATT\_\-PIN}!battery.c@{battery.c}}
\subsubsection[{BATT\_\-PIN}]{\setlength{\rightskip}{0pt plus 5cm}\#define BATT\_\-PIN~PD7}}
\label{battery_8c_a92165ee224e6e3601f6973cca883fe51}


Pin where the battery voltage will be readed. \hypertarget{battery_8c_aadcd026a2c91fe96c8134619c87bb72a}{
\index{battery.c@{battery.c}!BATT\_\-PORT@{BATT\_\-PORT}}
\index{BATT\_\-PORT@{BATT\_\-PORT}!battery.c@{battery.c}}
\subsubsection[{BATT\_\-PORT}]{\setlength{\rightskip}{0pt plus 5cm}\#define BATT\_\-PORT~PORTD}}
\label{battery_8c_aadcd026a2c91fe96c8134619c87bb72a}
\hypertarget{battery_8c_a4cf81b9098e2a01eacf1f7e46a492a55}{
\index{battery.c@{battery.c}!BATT\_\-VOLT\_\-MAX@{BATT\_\-VOLT\_\-MAX}}
\index{BATT\_\-VOLT\_\-MAX@{BATT\_\-VOLT\_\-MAX}!battery.c@{battery.c}}
\subsubsection[{BATT\_\-VOLT\_\-MAX}]{\setlength{\rightskip}{0pt plus 5cm}\#define BATT\_\-VOLT\_\-MAX~600}}
\label{battery_8c_a4cf81b9098e2a01eacf1f7e46a492a55}
\hypertarget{battery_8c_afad4dd6765302906f52c8df6f1dc69a5}{
\index{battery.c@{battery.c}!BATT\_\-VOLT\_\-MIN@{BATT\_\-VOLT\_\-MIN}}
\index{BATT\_\-VOLT\_\-MIN@{BATT\_\-VOLT\_\-MIN}!battery.c@{battery.c}}
\subsubsection[{BATT\_\-VOLT\_\-MIN}]{\setlength{\rightskip}{0pt plus 5cm}\#define BATT\_\-VOLT\_\-MIN~496}}
\label{battery_8c_afad4dd6765302906f52c8df6f1dc69a5}


\subsection{Function Documentation}
\hypertarget{battery_8c_a05c2e5b588ced1cd7312f5b0edc5b295}{
\index{battery.c@{battery.c}!ISR@{ISR}}
\index{ISR@{ISR}!battery.c@{battery.c}}
\subsubsection[{ISR}]{\setlength{\rightskip}{0pt plus 5cm}ISR (ADC\_\-vect)}}
\label{battery_8c_a05c2e5b588ced1cd7312f5b0edc5b295}
